function A(){
    this.name="张三"
    this.age="18"
}
const a = new A();

function B(){
    this.width=140
    this.height = 178   
    A.call(this)
}
A.prototype.afn = ()=>{
    console.log('我是A的方法')
}
const b = new B()
B.prototype = A.prototype
//Es6
class A{
    constructor(name,age){
        this.name = name
        this.age = age
    }
    currenData(){
        console.log(new Date())
    }
}
class B extends A{
    constructor(name,age){
        super(name,age)
        this.currenData()
    }
}
const b1 = new B("李四",23)
console.log(b1)